mongodb compass is not using "text" index for searching a regex expression |
您所在的位置:网站首页 › mongodb find or › mongodb compass is not using "text" index for searching a regex expression |
mongodb compass is not using "text" index for searching a regex expression
05 Apr, 2023
Programming
0
I want to search in mongodb a regex expression using text index (I believe for regex search this one is most beneficial). There is only one field on which to carry out the query. I have created the index like { "final : "text"} using mongodb compass. and then when i use this command in integrated mongosh terminal, db.hello1.find({"final" : { $regex: 'Cleanser', $options: 'i' }}).hint({final : "text"}).explain() It gives me the following error: planner returned error :: caused by :: hint provided does not correspond to an existing index While clearly the compound index exits, of type text _fts(text) _ftsx. Can someone guide me around this ? |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |